'use strict';
(function() {

    //注册路由
    ngApp.config(['$stateProvider', '$urlRouterProvider', 'NavDatasConstant', 'AppConfigConstant', function($stateProvider, $urlRouterProvider, NavDatasConstant, AppConfigConstant) {
        var appBasePath = AppConfigConstant.APP_BASE_PATH;

        var firstState = "/showcase";

        $urlRouterProvider.when("", firstState).when("/", firstState);
        $stateProvider.state("showcase", {
            url: "/showcase",
            templateUrl: appBasePath + "showcase/view/showcase.html",
            progress: 100,
            authors: 'zhaojjd,',
            label: "简介"
        });

        angular.forEach(NavDatasConstant, function(navData, key) {
            navData.label;
            navData.state;

            $stateProvider.state(navData.state, {
                url: navData.url,
                template: "<ui-view></ui-view>",
                controller: function($scope){},
                authors: navData.authors,
                progress: navData.progress,
                label: navData.label,
                description: navData.description,
                fileInfos: navData.fileInfos
            });

            angular.forEach(navData.items, function(state, key) {
                $stateProvider.state(state.state, {
                    url: state.url,
                    templateUrl: appBasePath + state.templateUrl,
                    authors: state.authors,
                    progress: state.progress,
                    label: state.label,
                    description: state.description,
                    fileInfos: state.fileInfos
                });
            });

        });

    }]);

})();